#include <asm.h>
#include <csr.h>

ENTRY(setup_exception)
  /* TODO: 
   * save exception_handler_entry into STVEC
   * enable global exceptions */
   
   la t1,exception_handler_entry
   csrw stvec,t1
   addi t1,zero,0x333
   csrw sie,t1
   addi t1,zero,0x22
   csrw CSR_SSTATUS,t1
   jr ra
ENDPROC(setup_exception)
/* maybe you need it? */
ENTRY(read_sip)
  csrr a0, CSR_SIP
  jr ra
ENDPROC(read_sip)